package tedu.week04.day02_thread.lesson2;

/**
 * <pre>
 *     线程的操作示例①.
 *      通过Runnable接口实现练习.
 * </pre>
 *
 * @author : resty
 * @date : 2019年07月09日    10时
 **/
public class MyThread2 implements Runnable {
    private int time;
    private String name;

    public MyThread2( String name,int time) {
        this.time = time;
        this.name = name;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("当前线程:"+name+"休眠了"+time+"ms");
    }
    public static void main(String[] args){
        MyThread2 mt1 = new MyThread2("A", 1000);
        MyThread2 mt2 = new MyThread2("B", 2000);
        MyThread2 mt3 = new MyThread2("C", 3000);

        new Thread(mt1).start();
        new Thread(mt2).start();
        new Thread(mt3).start();


    }
}
